home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 16805 < prev    next >
Encoding:
Text File  |  1996-08-05  |  2.2 KB  |  52 lines

  1. Newsgroups: comp.lang.c++
  2. Path: newsfeed.internetmci.com!miwok!linex1!news
  3. From: mfried@linex.com (Marty Fried)
  4. Subject: Re: Begging for help! Desperate!
  5. X-Nntp-Posting-Host: sp91.linex.com
  6. Message-ID: <316dca90.4800529@news.linex.com>
  7. Sender: news@linex1.linex.com
  8. Organization: Cirrius Cybernetics Corp
  9. X-Newsreader: Forte Agent .99e/32.201
  10. References: <4k4il4$ccr@cronkite.seas.gwu.edu> <N.040696.101312.44@ix.netcom.com>
  11. Date: Fri, 12 Apr 1996 03:18:08 GMT
  12.  
  13. Once upon a time (OK, it was Sat, 06 Apr 96 18:13:12 GMT),
  14. jhewett@ix.netcom.com (Jerry Hewett) wrote:
  15.  
  16. >Karim P. Draoui <kelly@seas.gwu.edu> asks:
  17. >
  18. >> I am trying to close a window in a program I am creating in Borland C++ 4.5.
  19. >> Basically what I am trying to do is open another window and close the current
  20. >> window.  I am having problems though using the CloseWindow function.  I am
  21. >> able to open another window, but I cannot close the current window.  I have
  22. >> used the books that come with Borland, but with no luck.  Anyways, if anyone
  23. >> can help me out as soon as possible I would really appreciate it.
  24. >
  25. >If I could look at your code I might be able to help you out with this.  At 
  26. >this point I'm guessing that the windows in question are child windows and not 
  27. >the parent window for your application (which would explain why things aren't 
  28. >quite working right :-).  If so, try trapping on the WM_CLOSE case in your 
  29. >WinProc and sending out a DestroyWindow command.  You'll still need to send the 
  30. >WM_CLOSE message to your window, though:
  31. >
  32. >    SendMessage (handle_to_your_first_window,WM_CLOSE,0,0);
  33. >    .
  34. >    .
  35. >    .
  36. >    case WM_CLOSE:
  37. >        DestroyWindow (handle_to_your_first_window);
  38. >        handle_to_your_first_window = 0;
  39. >        break;
  40. >
  41. What is the purpose of the SendMessage?  Why wouldn't you handle the
  42. WM_CLOSE message normally?  Doing the SendMessage seems to me to be
  43. more work.
  44.  
  45. Otherwise, I think your answer is correct (assuming he wants to
  46. destroy the window, and not just hide it). 
  47.  
  48. _______________________________________________________
  49. Marty Fried - mfried@linex.com     Press Enter to Exit
  50. San Anselmo, CA                           -NT message
  51. (MSVC4 + MFC) && (Win95 || NT);             
  52.